<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Cabinet Admin</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    <meta name="format-detection" content="telephone=no">
    <!--<script type="text/javascript" src="js/adaptive.js"></script>-->
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <link rel="stylesheet" href="../element-ui/index.ml.css">
    <script type="text/javascript" src="../js_code/jquery-3.6.1.min.js?v=2"></script>
    <script type="text/javascript" src="../element-ui/vue.js"></script>
    <!-- import JavaScript -->
    <script type="text/javascript" src="../element-ui/index.en.js"></script>

    <script src="../js_code/underscore-min.js"></script>
    <script src="../js_code/jquery-3.6.1.min.js"></script>
    <script src="../js_code/iotauth.js"></script>
    <script src="../js_code/kddemo.js"></script>
    <script>
        function refresh2() {
            window.location.reload();
        }
    </script>
    <style>
        .box-card {

            display: inline-block;
        }
    </style>
</head>
<body class="big_show">

<div>
    <input id="base_url" value="https://api.bestwond.com" style="width: 200px;border-radius: 5px;">
    App Id<input id="app_id" value="bw_99782120261911e" style="width: 200px;border-radius: 5px;">
    App Secret<input id="app_secret" value="99782238261911eebd3200163e198b20" style="width: 200px;border-radius: 5px;">

    <button onclick="kd.get_device_list()">Get Device List</button>
</div>
<div id="app"
     class="screen_app">
    <el-row>

        <el-card class="box-card" style="width: 700px;height: 460px;">
            <div slot="header" class="clearfix">
                <h2> Step 1. Set device {{device_number}} parcel</h2>
            </div>
            <el-form ref="form" :model="form" label-width="180px">
                <el-form-item label="Device Id:">
                    <el-input v-model="device_number"  style="width:320px;">
                    </el-input>
                </el-form-item>
                <el-form-item label="Parcel order no:">
                    <el-input v-model="order_no" :type='select_num' class="input-with-select"  style="width:320px;">
                        <el-select v-model="select_num" slot="append" placeholder="Select" style="width:120px;">
                            <el-option label="Num" value="number"></el-option>
                            <el-option label="Char" value="text"></el-option>
                        </el-select>
                    </el-input>
                </el-form-item>
                <el-form-item>
                    <el-button @click="set_device_order()" type="success"
                               style="margin-top: 5px;height:60px;width: 160px;font-weight: bolder;font-size: 25px;">
                        Confirm
                    </el-button>
                </el-form-item>
            </el-form>
        </el-card>

        <el-card class="box-card" style="width: 600px;height: 460px;background-color: black;color:white;">
            <div slot="header" class="clearfix">
                <span>{{device_number}} API Result</span>
            </div>

            <div v-if="api_data">
                Msg: {{api_data.msg}}
                <div v-if="api_data.data">
                    <div>Device number: {{api_data.data.device_number}}</div>
                    <div>Parcel Order no: {{api_data.data.order_no}}</div>
                </div>
            </div>

            {{api_data}}
        </el-card>
    </el-row>
</div>
</body>

<script>

    bw = new Vue({
        el: '#app',
        data: {
            form: {},
            device_number: "2100014859",
            notice_email: "",
            loading: false,
            order_no: "",
            save_code: "",
            take_code: "",
            select_num: "number",
            api_data: "",
            box_size: "S"
        },
        created: function () {

        },
        methods: {
            set_device_order: function () {
                this.api_data = kd.set_device_box_call_ad(this.device_number, this.order_no);
            },
            set_device_orders_email: function () {
                this.api_data = kd.set_device_orders_email_notice(this.device_number, this.order_no, this.box_size, this.notice_email);
            },
            save_in_by_input: function () {
                this.api_data = kd.set_device_order_save_or_take(this.device_number, this.save_code, this.box_size, 'save');
            },
            take_out_by_input: function () {
                this.api_data = kd.set_device_order_save_or_take(this.device_number, this.take_code, this.box_size, 'take');
            }
        }
    });
</script>
</html>
